<template>
    <div class="alert-mask" @touchstart="cancel">
        <div class="alert-content">
            <div class="content"><slot></slot></div>
            <div class="sure" @touchstart="cancel">确 定</div>
        </div>
    </div>
</template>

<script>
import {mapState} from 'vuex';
export default {
    computed:{
        ...mapState([
            "isAlert",
        ])
    },
    methods:{
        cancel:function(){
            this.$store.commit("setIsAlert",false);
        }
    }
}
</script>

<style scoped>
.alert-mask{
    position: fixed;
    top:0;
    left:0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, .4);
    z-index:100;
}
.alert-content{
    width: 63vw;
    height: 18vh;
    background: rgba(40, 40, 40, .8);
    margin: 0 auto;
    position: relative;
    top:42%;
    text-align: center;
    color: #eee;
    padding: 3vw 0;
    z-index:101;
    animation: showalert 0.8s;
}
.content{
    height: 8.5vh;
    line-height: 8.5vh;
    font-size: 1.1rem;
}
.sure{
    color: #4abdcc;
    padding-top: 2vw;
    border-top: 1px solid #777;
    font-size: 1.25rem;
}

@keyframes showalert{
    0%{
        top:38%;
    }
    50%{
        top:20%;
    }
    100%{
        top:42%
    }
}
</style>